<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url> 
        <loc><?php echo Router::url('/',true); ?></loc> 
        <changefreq>daily</changefreq> 
        <priority>1.0</priority> 
    </url> 

    <!-- Category-->     
    <?php foreach ($categories as $cat):?> 
		<?php if($cat['Parent']['id']){
			$tmp = $this->Categories->getSeoUrl($cat['Category']['id']);
			$parentUrl = 'http://'.$_SERVER['SERVER_NAME'].Router::url($tmp);
		}else{
			$parentUrl = 'http://'.$_SERVER['SERVER_NAME'].Router::url( '/' . $cat['Category']['slug']);
		} ?>
    <url> 
        <loc>
					<?php echo $parentUrl; ?>
				</loc> 
        <lastmod><?php echo CakeTime::toAtom($cat['Category']['created_at']); ?></lastmod> 
				<changefreq>weekly</changefreq>
        <priority>0.5</priority> 
    </url> 
		<!-- get Products of category -->
		<?php if($cat['Product']){ 
				foreach($cat['Product'] as $product){?>
    <url> 
        <loc>
					<?php echo $parentUrl . "/" . $product['slug']; ?>
				</loc> 
        <lastmod><?php echo CakeTime::toAtom($product['updated_at']); ?></lastmod> 
				<changefreq>weekly</changefreq>
        <priority>0.5</priority> 
    </url>
		<?php }} ?>
		<!-- get Post of category -->
		<?php if($cat['Post']){ 
				foreach($cat['Post'] as $post){?>
    <url> 
        <loc>
					<?php echo $parentUrl . "/" . $post['slug']; ?>
				</loc> 
        <lastmod><?php echo CakeTime::toAtom($post['updated_at']); ?></lastmod> 
				<changefreq>weekly</changefreq>
        <priority>0.5</priority> 
    </url>
		<?php }} ?>

    <?php endforeach; ?> 



</urlset> 
